package com.atguigu.spzx.common.handler.exception;

import com.atguigu.spzx.model.common.ResultCodeEnum;
import lombok.Data;

/**
 * title:
 * author: zgl
 * date: 2023/12/26
 * description：
 */
@Data
public class SpzxException extends RuntimeException {
    private Integer code;
    private String message;
    private Throwable e;

    public SpzxException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public SpzxException(Integer code, String message, Throwable e) {
        this.code = code;
        this.message = message;
        this.e = e;
    }

    public SpzxException(ResultCodeEnum resultCodeEnum, Throwable e) {
        this(resultCodeEnum.getCode(), resultCodeEnum.getMessage(), e);
    }

    public SpzxException(ResultCodeEnum resultCodeEnum) {
        this(resultCodeEnum.getCode(), resultCodeEnum.getMessage());
    }
}
